﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Repository;
using static DevExpress.XtraReports.Design.View.Office2003PaintHelper;
using System.Collections;
using DiaoPaiDaYin;
using DevExpress.XtraEditors.Popup;
using DevExpress.XtraGrid.Editors;
using DevExpress.Utils.Win;
using DevExpress.XtraLayout;
using Luna小店.UC.门店下单.DTO;
using Luna小店.DTO.坚山;
using DevExpress.XtraGrid.Demos.util;
using Luna小店.service;
using System.Diagnostics;

namespace Luna小店.UC.设计点
{
    public partial class UC设计点 : DevExpress.XtraEditors.XtraUserControl
    {
        public DTO坚山款式 dto坚山款式 { get; set; }
        public String STYLE_ID { get; set; }
        public List<DTODesignPoints> Dto设计点s = new List<DTODesignPoints>();
        public String OPTION_VALUE { get; set; }
        public String ITEM_NAME_CN { get; set; }
        public String ITEM_VALUE { get; set; }
        private String 刺绣字体 { get; set; }
        private String 刺绣字体1 { get; set; }
        private String 刺绣颜色 { get; set; }
        private String 刺绣颜色1 { get; set; }
        private String 刺绣位置 { get; set; }
        private String 刺绣位置1 { get; set; }
        private String 刺绣大小 { get; set; }
        private String 刺绣大小1 { get; set; }
        private GridEditorCollection gridEditors;
        public UC设计点(List<DTODesignPoints> Dto设计点s,String styleid, DTO坚山款式 dto坚山款式)
        {
            this.dto坚山款式 = dto坚山款式;
            this.Dto设计点s = Dto设计点s;
            InitializeComponent();
            this.gridEditors = new GridEditorCollection();
            this.STYLE_ID = styleid;
            
            
            InitInplaceEditors();
            this.gridControl设计点.DataSource = gridEditors;
            Stopwatch stopWatch = new Stopwatch();
            stopWatch.Start();
            this.Dto设计点s = ItemService.SortItemList(this.Dto设计点s);
            stopWatch.Stop();
            System.Diagnostics.Debug.WriteLine("SortItemList执行时间 " + stopWatch.ElapsedMilliseconds + " ms.");

            String str = FunctionHelper.JsonSerialization(this.Dto设计点s);
        }
        /// <summary>
        /// 订单导入数据注入
        /// </summary>
        /// <param name="Dto设计点s"></param>
        /// <param name="dto坚山款式"></param>
        public UC设计点(List<DTODesignPoints> Dto设计点s, DTO坚山款式 dto坚山款式)
        {
            this.dto坚山款式 = dto坚山款式;
            this.Dto设计点s = Dto设计点s;
            InitializeComponent();
            this.gridEditors = new GridEditorCollection();

            this.ExcelDataInjection();
            this.gridControl设计点.DataSource = gridEditors;
            Stopwatch stopWatch = new Stopwatch();
            stopWatch.Start();
            this.Dto设计点s = ItemService.SortItemList(this.Dto设计点s);
            stopWatch.Stop();
            System.Diagnostics.Debug.WriteLine("SortItemList执行时间 " + stopWatch.ElapsedMilliseconds + " ms.");

            String str = FunctionHelper.JsonSerialization(this.Dto设计点s);
        }
        public UC设计点()
        {
            InitializeComponent();
        }

        void InitInplaceEditors()
        {
            #region sql
            DataTable dt = SQLmtm.GetDataTable("SELECT\n" +
                            "	a_kuanshi_p.id,\n" +
                            "	a_kuanshi_p.STYLEID,\n" +
                            "	a_kuanshi_p.STYLE_NAME_CN,\n" +
                            "	a_kuanshi_p.STYLE_CATEGORY_CD,\n" +
                            "	a_kuanshi_p.ITEM_CATEGORY_CD,\n" +
                            "	a_kuanshi_p.PARENT_ID,\n" +
                            "	a_kuanshi_p.PARENT_VALUE,\n" +
                            "	a_kuanshi_p.FILE_ID,\n" +
                            "	a_kuanshi_p.FLAG,\n" +
                            "	a_kuanshi_p.PICN,\n" +
                            "	a_kuanshi_p.PICURL,\n" +
                            "	a_kuanshi_p.DEFAULT_FLAG,\n" +
                            "	a_kuanshi_p.ITEM_NAME_CN,-- a_kuanshi_p.ITEM_CD,\n" +
                            "	a_kuanshi_p.ITEM_VALUE,\n" +
                            "	a_kuanshi_p.DEFAULT_NAME_CN,\n" +
                            "	a_kuanshi_p.DEFAULT_CD,\n" +
                            "	a_kuanshi_p.DEFAULT_VALUE,\n" +
                            "	a_designoption_p.ITEM_CD \n" +
                            "FROM\n" +
                            "	a_kuanshi_p\n" +
                            "	LEFT JOIN a_designoption_p ON a_kuanshi_p.ITEM_VALUE = a_designoption_p.ITEM_VALUE \n" +
                            "WHERE\n" +
                            "	a_kuanshi_p.STYLEID = '" + STYLE_ID + "';");
            #endregion

            foreach (DataRow dr in dt.Rows)
            {
                this.Dto设计点s.Add(new DTODesignPoints(dr, 1));
                if (this.dto坚山款式.刺绣设计点s.Contains(dr["ITEM_VALUE"].ToString()))
                {
                    switch (dr["ITEM_VALUE"].ToString())
                    {
                        case "4SMO":
                            this.searchLookUpEdit刺绣字体.Properties.DataSource = RepositoryItemSearchLookUpEdit设计点.get设计点("4SMO", dr["id"].ToString());
                            break;
                        case "4SMC":
                            this.searchLookUpEdit刺绣颜色.Properties.DataSource = RepositoryItemSearchLookUpEdit设计点.get设计点("4SMC", dr["id"].ToString());
                            break;
                        case "4SMP":
                            this.searchLookUpEdit刺绣位置.Properties.DataSource = RepositoryItemSearchLookUpEdit设计点.get设计点("4SMP", dr["id"].ToString());
                            break;
                        case "4SMS":
                            this.searchLookUpEdit刺绣大小.Properties.DataSource = RepositoryItemSearchLookUpEdit设计点.get设计点("4SMS", dr["id"].ToString());
                            break;
                    }
                }
                else
                {
                    this.gridEditors.Add(new RepositoryItemSearchLookUpEdit设计点(dr, this.Dto设计点s[this.Dto设计点s.Count - 1]), dr["ITEM_NAME_CN"].ToString(), 3);
                }
            }
        }

        private void gridView1_CustomRowCellEdit(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e)
        {
            if (e.Column == this.gridEditorValue)
            {
                GridEditorItem item = gridView设计点.GetRow(e.RowHandle) as GridEditorItem;
                if (item != null) e.RepositoryItem = item.RepositoryItem;
            }
        }

        public class GridEditorItem
        {
            string fName;
            object fValue;
            RepositoryItem fRepositoryItem;

            public GridEditorItem(RepositoryItem fRepositoryItem, string fName, object fValue)
            {
                this.fRepositoryItem = fRepositoryItem;
                this.fName = fName;
                this.fValue = fValue;
            }
            public string Name { get { return this.fName; } }
            public object Value { get { return this.fValue; } set { this.fValue = value; } }
            public RepositoryItem RepositoryItem { get { return this.fRepositoryItem; } }
        }

        class GridEditorCollection : ArrayList
        {
            public GridEditorCollection()
            {
            }
            public new GridEditorItem this[int index] { get { return base[index] as GridEditorItem; } }
            public void Add(RepositoryItem fRepositoryItem, string fName, object fValue)
            {
                base.Add(new GridEditorItem(fRepositoryItem, fName, fValue));
            }
        }


        #region 设计点
        /// <summary>
        /// 点击选择后的行为
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void searchLookUpEdit设计点View_Click(object sender, EventArgs e)
        {
            var a = ((SearchLookUpEdit)sender).Properties.View.GetSelectedRows();
            foreach (int rowHandle in a)
            {
                //Frm面料选择.mianliaocd = this.searchLookUpEdit面料.Properties.View.GetRowCellValue(rowHandle, "Code").ToString();
                this.OPTION_VALUE = ((SearchLookUpEdit)sender).Properties.View.GetRowCellValue(rowHandle, "OPTION_VALUE").ToString();
                this.ITEM_NAME_CN = ((SearchLookUpEdit)sender).Properties.View.GetRowCellValue(rowHandle, "ITEM_NAME_CN").ToString();
                this.ITEM_VALUE = ((SearchLookUpEdit)sender).Properties.View.GetRowCellValue(rowHandle, "ITEM_VALUE").ToString();
                foreach (DTODesignPoints dto in this.Dto设计点s)
                {
                    if (dto.itemValue == this.ITEM_VALUE)
                    {
                        dto.optionValue = this.OPTION_VALUE;
                        this.repositoryItemSearchLookUpEdit1.DisplayMember = this.ITEM_NAME_CN;
                    }
                }

            }
            //this.mianliaoid.Text = this.dto无订单打印.materials_id;
            //this.mianliaocd.Text = this.dto无订单打印.materials_cd;
            //this.chengfen.Text = this.dto无订单打印.materialComposition;
        }





        #endregion

        private void textBox刺绣内容_TextChanged(object sender, EventArgs e)
        {
            foreach(DTODesignPoints dto in Dto设计点s)
            {
                if(dto.itemValue== "4SMT")
                {
                    dto.optionValue = textBox刺绣内容.Text;
                }
            }
        }

        #region 选择刺绣字体
        /// <summary>
        /// 绑定清空事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void searchLookUpEdit刺绣字体_Popup(object sender, EventArgs e)
        {
            //得到当前SearchLookUpEdit弹出窗体
            PopupSearchLookUpEditForm form = (sender as IPopupControl).PopupWindow as PopupSearchLookUpEditForm;
            SearchEditLookUpPopup popup = form.Controls.OfType<SearchEditLookUpPopup>().FirstOrDefault();
            LayoutControl layout = popup.Controls.OfType<LayoutControl>().FirstOrDefault();
            //如果窗体内空间没有确认按钮，则自定义确认simplebutton，取消simplebutton，选中结果label
            if (layout.Controls.OfType<Control>().Where(ct => ct.Name == "btOK").FirstOrDefault() == null)
            {
                //得到空的空间
                EmptySpaceItem a = layout.Items.Where(it => it.TypeName == "EmptySpaceItem").FirstOrDefault() as EmptySpaceItem;

                //得到取消按钮，重写点击事件
                Control clearBtn = layout.Controls.OfType<Control>().Where(ct => ct.Name == "btClear").FirstOrDefault();
                LayoutControlItem clearLCI = (LayoutControlItem)layout.GetItemByControl(clearBtn);
                clearBtn.Click += clearBtn刺绣字体_Click;

                //添加一个simplebutton控件(确认按钮)
                LayoutControlItem myLCI = (LayoutControlItem)clearLCI.Owner.CreateLayoutItem(clearLCI.Parent);
                myLCI.TextVisible = false;
            }
        }
        /// <summary>
        /// 点击选择后的行为
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void searchLookUpEdit刺绣字体View_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            this.刺绣字体 = FunctionHelper.GetgridViewValue(this.searchLookUpEdit刺绣字体.Properties.View, e.RowHandle, "ITEM_NAME_CN").ToString();
            this.刺绣字体1 = FunctionHelper.GetgridViewValue(this.searchLookUpEdit刺绣字体.Properties.View, e.RowHandle, "OPTION_VALUE").ToString();
            foreach (DTODesignPoints dto in Dto设计点s)
            {
                if (dto.itemValue == "4SMO")
                {
                    dto.name = 刺绣字体;
                    dto.optionValue = 刺绣字体1;
                }
            }
        }
        /// <summary>
        /// 清除按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void clearBtn刺绣字体_Click(object sender, EventArgs e)
        {
            this.searchLookUpEdit刺绣字体.ToolTip = null;
            searchLookUpEdit刺绣字体.EditValue = null;
        }
        /// <summary>
        /// 选完之后的显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void searchLookUpEdit刺绣字体_CustomDisplayText(object sender, DevExpress.XtraEditors.Controls.CustomDisplayTextEventArgs e)
        {
            if (null != e.Value)
                e.DisplayText = this.刺绣字体1 + ":" + this.刺绣字体;
        }
        #endregion

        #region 选择刺绣颜色
        /// <summary>
        /// 绑定清空事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void searchLookUpEdit刺绣颜色_Popup(object sender, EventArgs e)
        {
            //得到当前SearchLookUpEdit弹出窗体
            PopupSearchLookUpEditForm form = (sender as IPopupControl).PopupWindow as PopupSearchLookUpEditForm;
            SearchEditLookUpPopup popup = form.Controls.OfType<SearchEditLookUpPopup>().FirstOrDefault();
            LayoutControl layout = popup.Controls.OfType<LayoutControl>().FirstOrDefault();
            //如果窗体内空间没有确认按钮，则自定义确认simplebutton，取消simplebutton，选中结果label
            if (layout.Controls.OfType<Control>().Where(ct => ct.Name == "btOK").FirstOrDefault() == null)
            {
                //得到空的空间
                EmptySpaceItem a = layout.Items.Where(it => it.TypeName == "EmptySpaceItem").FirstOrDefault() as EmptySpaceItem;

                //得到取消按钮，重写点击事件
                Control clearBtn = layout.Controls.OfType<Control>().Where(ct => ct.Name == "btClear").FirstOrDefault();
                LayoutControlItem clearLCI = (LayoutControlItem)layout.GetItemByControl(clearBtn);
                clearBtn.Click += clearBtn刺绣颜色_Click;

                //添加一个simplebutton控件(确认按钮)
                LayoutControlItem myLCI = (LayoutControlItem)clearLCI.Owner.CreateLayoutItem(clearLCI.Parent);
                myLCI.TextVisible = false;
            }
        }
        /// <summary>
        /// 点击选择后的行为
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void searchLookUpEdit刺绣颜色View_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            this.刺绣颜色 = FunctionHelper.GetgridViewValue(this.searchLookUpEdit刺绣颜色.Properties.View, e.RowHandle, "ITEM_NAME_CN").ToString();
            this.刺绣颜色1 = FunctionHelper.GetgridViewValue(this.searchLookUpEdit刺绣颜色.Properties.View, e.RowHandle, "OPTION_VALUE").ToString();
            foreach (DTODesignPoints dto in Dto设计点s)
            {
                if (dto.itemValue == "4SMC")
                {
                    dto.name = 刺绣颜色;
                    dto.optionValue = 刺绣颜色1;
                }
            }
        }
        /// <summary>
        /// 清除按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void clearBtn刺绣颜色_Click(object sender, EventArgs e)
        {
            this.searchLookUpEdit刺绣颜色.ToolTip = null;
            searchLookUpEdit刺绣颜色.EditValue = null;
        }
        /// <summary>
        /// 选完之后的显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void searchLookUpEdit刺绣颜色_CustomDisplayText(object sender, DevExpress.XtraEditors.Controls.CustomDisplayTextEventArgs e)
        {
            if (null != e.Value)
                e.DisplayText = this.刺绣颜色1 + ":" + this.刺绣颜色;
        }
        #endregion

        #region 选择刺绣位置
        /// <summary>
        /// 绑定清空事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void searchLookUpEdit刺绣位置_Popup(object sender, EventArgs e)
        {
            //得到当前SearchLookUpEdit弹出窗体
            PopupSearchLookUpEditForm form = (sender as IPopupControl).PopupWindow as PopupSearchLookUpEditForm;
            SearchEditLookUpPopup popup = form.Controls.OfType<SearchEditLookUpPopup>().FirstOrDefault();
            LayoutControl layout = popup.Controls.OfType<LayoutControl>().FirstOrDefault();
            //如果窗体内空间没有确认按钮，则自定义确认simplebutton，取消simplebutton，选中结果label
            if (layout.Controls.OfType<Control>().Where(ct => ct.Name == "btOK").FirstOrDefault() == null)
            {
                //得到空的空间
                EmptySpaceItem a = layout.Items.Where(it => it.TypeName == "EmptySpaceItem").FirstOrDefault() as EmptySpaceItem;

                //得到取消按钮，重写点击事件
                Control clearBtn = layout.Controls.OfType<Control>().Where(ct => ct.Name == "btClear").FirstOrDefault();
                LayoutControlItem clearLCI = (LayoutControlItem)layout.GetItemByControl(clearBtn);
                clearBtn.Click += clearBtn刺绣位置_Click;

                //添加一个simplebutton控件(确认按钮)
                LayoutControlItem myLCI = (LayoutControlItem)clearLCI.Owner.CreateLayoutItem(clearLCI.Parent);
                myLCI.TextVisible = false;
            }
        }
        /// <summary>
        /// 点击选择后的行为
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void searchLookUpEdit刺绣位置View_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            this.刺绣位置 = FunctionHelper.GetgridViewValue(this.searchLookUpEdit刺绣位置.Properties.View, e.RowHandle, "ITEM_NAME_CN").ToString();
            this.刺绣位置1 = FunctionHelper.GetgridViewValue(this.searchLookUpEdit刺绣位置.Properties.View, e.RowHandle, "OPTION_VALUE").ToString();
            foreach (DTODesignPoints dto in Dto设计点s)
            {
                if (dto.itemValue == "4SMP")
                {
                    dto.name = 刺绣位置;
                    dto.optionValue = 刺绣位置1;
                }
            }
        }
        /// <summary>
        /// 清除按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void clearBtn刺绣位置_Click(object sender, EventArgs e)
        {
            this.searchLookUpEdit刺绣位置.ToolTip = null;
            searchLookUpEdit刺绣位置.EditValue = null;
        }
        /// <summary>
        /// 选完之后的显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void searchLookUpEdit刺绣位置_CustomDisplayText(object sender, DevExpress.XtraEditors.Controls.CustomDisplayTextEventArgs e)
        {
            if (null != e.Value)
                e.DisplayText = this.刺绣位置1 + ":" + this.刺绣位置;
        }
        #endregion

        #region 选择刺绣大小
        /// <summary>
        /// 绑定清空事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void searchLookUpEdit刺绣大小_Popup(object sender, EventArgs e)
        {
            //得到当前SearchLookUpEdit弹出窗体
            PopupSearchLookUpEditForm form = (sender as IPopupControl).PopupWindow as PopupSearchLookUpEditForm;
            SearchEditLookUpPopup popup = form.Controls.OfType<SearchEditLookUpPopup>().FirstOrDefault();
            LayoutControl layout = popup.Controls.OfType<LayoutControl>().FirstOrDefault();
            //如果窗体内空间没有确认按钮，则自定义确认simplebutton，取消simplebutton，选中结果label
            if (layout.Controls.OfType<Control>().Where(ct => ct.Name == "btOK").FirstOrDefault() == null)
            {
                //得到空的空间
                EmptySpaceItem a = layout.Items.Where(it => it.TypeName == "EmptySpaceItem").FirstOrDefault() as EmptySpaceItem;

                //得到取消按钮，重写点击事件
                Control clearBtn = layout.Controls.OfType<Control>().Where(ct => ct.Name == "btClear").FirstOrDefault();
                LayoutControlItem clearLCI = (LayoutControlItem)layout.GetItemByControl(clearBtn);
                clearBtn.Click += clearBtn刺绣大小_Click;

                //添加一个simplebutton控件(确认按钮)
                LayoutControlItem myLCI = (LayoutControlItem)clearLCI.Owner.CreateLayoutItem(clearLCI.Parent);
                myLCI.TextVisible = false;
            }
        }
        /// <summary>
        /// 点击选择后的行为
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void searchLookUpEdit刺绣大小View_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            this.刺绣大小 = FunctionHelper.GetgridViewValue(this.searchLookUpEdit刺绣大小.Properties.View, e.RowHandle, "ITEM_NAME_CN").ToString();
            this.刺绣大小1 = FunctionHelper.GetgridViewValue(this.searchLookUpEdit刺绣大小.Properties.View, e.RowHandle, "OPTION_VALUE").ToString();
            foreach (DTODesignPoints dto in Dto设计点s)
            {
                if (dto.itemValue == "4SMS")
                {
                    dto.name = 刺绣大小;
                    dto.optionValue = 刺绣大小1;
                }
            }
        }
        /// <summary>
        /// 清除按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void clearBtn刺绣大小_Click(object sender, EventArgs e)
        {
            this.searchLookUpEdit刺绣大小.ToolTip = null;
            searchLookUpEdit刺绣大小.EditValue = null;
        }
        /// <summary>
        /// 选完之后的显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void searchLookUpEdit刺绣大小_CustomDisplayText(object sender, DevExpress.XtraEditors.Controls.CustomDisplayTextEventArgs e)
        {
            if (null != e.Value)
                e.DisplayText = this.刺绣大小1 + ":" + this.刺绣大小;
        }
        #endregion

        private void gridView设计点_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            if(e.Column.Name == "gridEditorName"||e.Column.Name== "gridEditorValue")
            {
                if (this.Dto设计点s[e.RowHandle].optionValue != this.Dto设计点s[e.RowHandle].defaultValue)
                {
                    e.Appearance.BackColor = Color.Red;
                }
            }
        }
        

        private void ExcelDataInjection()
        {
            #region 串子
            String str = "[{\"ITEM_TYPE_NAME_CN\":\"袖子\",\"ITEM_CD\":\"SHIRT_DESIGN_SSL\",\"ITEM_VALUE\":\"4SSL\",\"OPTION_VALUE\":\"KSSL1\",\"ENABLE_FLAG\":\"1\",\"DELETE_FLAG\":\"0\",\"DEFAULT_VALUE\":\"KSSL1\",\"Picture\":null,\"Name\":\"长袖\",\"Style\":null},{\"ITEM_TYPE_NAME_CN\":\"领子\",\"ITEM_CD\":\"SHIRT_DESIGN_SCO\",\"ITEM_VALUE\":\"4SCO\",\"OPTION_VALUE\":\"KSD24\",\"ENABLE_FLAG\":\"1\",\"DELETE_FLAG\":\"0\",\"DEFAULT_VALUE\":\"KSD24\",\"Picture\":null,\"Name\":\"小方领\",\"Style\":null},{\"ITEM_TYPE_NAME_CN\":\"袖头\",\"ITEM_CD\":\"SHIRT_DESIGN_SCU\",\"ITEM_VALUE\":\"4SCU\",\"OPTION_VALUE\":\"KSC31\",\"ENABLE_FLAG\":\"1\",\"DELETE_FLAG\":\"0\",\"DEFAULT_VALUE\":\"KSC31\",\"Picture\":null,\"Name\":\"切角一眼一扣\",\"Style\":null},{\"ITEM_TYPE_NAME_CN\":\"衬布\",\"ITEM_CD\":\"SHIRT_DESIGN_SSK\",\"ITEM_VALUE\":\"4SSK\",\"OPTION_VALUE\":\"KSS3\",\"ENABLE_FLAG\":\"1\",\"DELETE_FLAG\":\"0\",\"DEFAULT_VALUE\":\"KSS3\",\"Picture\":null,\"Name\":\"领：普通S1   袖头：普通S1\",\"Style\":null},{\"ITEM_TYPE_NAME_CN\":\"前立\",\"ITEM_CD\":\"SHIRT_DESIGN_SFP\",\"ITEM_VALUE\":\"4SFP\",\"OPTION_VALUE\":\"KSFP1\",\"ENABLE_FLAG\":\"1\",\"DELETE_FLAG\":\"0\",\"DEFAULT_VALUE\":\"KSFP1\",\"Picture\":null,\"Name\":\"三折前立\",\"Style\":null},{\"ITEM_TYPE_NAME_CN\":\"胸兜\",\"ITEM_CD\":\"SHIRT_DESIGN_SBP\",\"ITEM_VALUE\":\"4SBP\",\"OPTION_VALUE\":\"KSBP1\",\"ENABLE_FLAG\":\"1\",\"DELETE_FLAG\":\"0\",\"DEFAULT_VALUE\":\"KSBP1\",\"Picture\":null,\"Name\":\"无胸兜\",\"Style\":null},{\"ITEM_TYPE_NAME_CN\":\"后背款式\",\"ITEM_CD\":\"SHIRT_DESIGN_SBA\",\"ITEM_VALUE\":\"4SBA\",\"OPTION_VALUE\":\"KSBA3\",\"ENABLE_FLAG\":\"1\",\"DELETE_FLAG\":\"0\",\"DEFAULT_VALUE\":\"KSBA3\",\"Picture\":null,\"Name\":\"后背两侧褶\",\"Style\":null},{\"ITEM_TYPE_NAME_CN\":\"领袖线宽\",\"ITEM_CD\":\"SHIRT_DESIGN_SST\",\"ITEM_VALUE\":\"4SST\",\"OPTION_VALUE\":\"KSCN1\",\"ENABLE_FLAG\":\"1\",\"DELETE_FLAG\":\"0\",\"DEFAULT_VALUE\":\"KSCN1\",\"Picture\":null,\"Name\":\"0.15cm\",\"Style\":null},{\"ITEM_TYPE_NAME_CN\":\"过肩\",\"ITEM_CD\":\"SHIRT_DESIGN_SBY\",\"ITEM_VALUE\":\"4SBJ\",\"OPTION_VALUE\":\"KSBJ2\",\"ENABLE_FLAG\":\"1\",\"DELETE_FLAG\":\"0\",\"DEFAULT_VALUE\":\"KSBJ2\",\"Picture\":null,\"Name\":\"拼接过肩\",\"Style\":null},{\"ITEM_TYPE_NAME_CN\":\"配料\",\"ITEM_CD\":\"SHIRT_DESIGN_CONTRAST\",\"ITEM_VALUE\":\"4SCON\",\"OPTION_VALUE\":\"\",\"ENABLE_FLAG\":\"1\",\"DELETE_FLAG\":\"0\",\"DEFAULT_VALUE\":\"\",\"Picture\":null,\"Name\":\"\",\"Style\":null},{\"ITEM_TYPE_NAME_CN\":\"第一扣位\",\"ITEM_CD\":\"SHIRT_DESIGN_FBP\",\"ITEM_VALUE\":\"FBP\",\"OPTION_VALUE\":\"FBP_01\",\"ENABLE_FLAG\":\"1\",\"DELETE_FLAG\":\"0\",\"DEFAULT_VALUE\":\"FBP_01\",\"Picture\":null,\"Name\":\"5.5\",\"Style\":null},{\"ITEM_TYPE_NAME_CN\":\"扣号\",\"ITEM_CD\":\"SHIRT_DESIGN_BUT\",\"ITEM_VALUE\":\"4BUT\",\"OPTION_VALUE\":\"KSFB1\",\"ENABLE_FLAG\":\"1\",\"DELETE_FLAG\":\"0\",\"DEFAULT_VALUE\":\"KSFB1\",\"Picture\":null,\"Name\":\"马贝 11.5mm/9mm\",\"Style\":null},{\"ITEM_TYPE_NAME_CN\":\"刺绣字体\",\"ITEM_CD\":\"SHIRT_MONOGRAM_SMO\",\"ITEM_VALUE\":\"4SMO\",\"OPTION_VALUE\":\"KSF03\",\"ENABLE_FLAG\":\"1\",\"DELETE_FLAG\":\"0\",\"DEFAULT_VALUE\":\"\",\"Picture\":null,\"Name\":\"花体\",\"Style\":null},{\"ITEM_TYPE_NAME_CN\":\"刺绣颜色\",\"ITEM_CD\":\"SHIRT_MONOGRAM_SMC\",\"ITEM_VALUE\":\"4SMC\",\"OPTION_VALUE\":\"K520\",\"ENABLE_FLAG\":\"1\",\"DELETE_FLAG\":\"0\",\"DEFAULT_VALUE\":\"\",\"Picture\":null,\"Name\":\"樱花红\",\"Style\":null},{\"ITEM_TYPE_NAME_CN\":\"刺绣位置\",\"ITEM_CD\":\"SHIRT_MONOGRAM_SMP\",\"ITEM_VALUE\":\"4SMP\",\"OPTION_VALUE\":\"KSEM6\",\"ENABLE_FLAG\":\"1\",\"DELETE_FLAG\":\"0\",\"DEFAULT_VALUE\":\"\",\"Picture\":null,\"Name\":\"左胸兜\",\"Style\":null},{\"ITEM_TYPE_NAME_CN\":\"刺绣尺寸\",\"ITEM_CD\":\"SHIRT_MONOGRAM_SMS\",\"ITEM_VALUE\":\"4SMS\",\"OPTION_VALUE\":\"MS6\",\"ENABLE_FLAG\":\"1\",\"DELETE_FLAG\":\"0\",\"DEFAULT_VALUE\":\"\",\"Picture\":null,\"Name\":\"6mm 普通\",\"Style\":null},{\"ITEM_TYPE_NAME_CN\":\"刺绣内容\",\"ITEM_CD\":\"SHIRT_MONOGRAM_SCO\",\"ITEM_VALUE\":\"4SMT\",\"OPTION_VALUE\":\"测试刺绣\",\"ENABLE_FLAG\":\"1\",\"DELETE_FLAG\":\"0\",\"DEFAULT_VALUE\":\"\",\"Picture\":null,\"Name\":\"\",\"Style\":null}]";
            #endregion
            this.Dto设计点s = FunctionHelper.JsonDeserialization<List<DTODesignPoints>>(str);
            foreach (DTODesignPoints dto in this.Dto设计点s)
            {
                if (this.dto坚山款式.刺绣设计点s.Contains(dto.itemValue))
                {
                    switch (dto.itemValue)
                    {
                        case "4SMO":
                            //this.searchLookUpEdit刺绣字体.Properties.DataSource = RepositoryItemSearchLookUpEdit设计点.get设计点("4SMO", "-202744700807938048");
                            this.刺绣字体1 = dto.optionValue;
                            this.刺绣字体 = dto.name;
                            this.searchLookUpEdit刺绣字体.Properties.DataSource = new DataTable();
                            this.searchLookUpEdit刺绣字体.EditValue = this.刺绣字体1 + ":" + this.刺绣字体;
                            break;
                        case "4SMC":
                            this.刺绣颜色1 = dto.optionValue;
                            this.刺绣颜色 = dto.name;
                            this.searchLookUpEdit刺绣颜色.Properties.DataSource = new DataTable();
                            this.searchLookUpEdit刺绣颜色.EditValue = this.刺绣颜色1 + ":" + this.刺绣颜色;
                            break;
                        case "4SMP":
                            this.刺绣位置1 = dto.optionValue;
                            this.刺绣位置 = dto.name;
                            this.searchLookUpEdit刺绣位置.Properties.DataSource = new DataTable();
                            this.searchLookUpEdit刺绣位置.EditValue = this.刺绣位置1 + ":" + this.刺绣位置;
                            break;
                        case "4SMS":
                            this.刺绣大小1 = dto.optionValue;
                            this.刺绣大小 = dto.name;
                            this.searchLookUpEdit刺绣大小.Properties.DataSource = new DataTable();
                            this.searchLookUpEdit刺绣大小.EditValue = this.刺绣大小1 + ":" + this.刺绣大小;
                            break;
                        case "4SMT":
                            this.textBox刺绣内容.Text = dto.optionValue;
                            break;
                    }
                }
                else
                {
                    this.gridEditors.Add(new RepositoryItemSearchLookUpEdit设计点(dto), dto.itemTypeNameCn, 3);
                }
            }
        }
    }
}
